﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Index.aspx.cs" Inherits="Users_Index" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../css/Site.css" rel="stylesheet" type="text/css" />
<link href="../css/smoothness/jquery-ui-1.8.2.custom.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div style="padding: 4px; margin: 5px;">
        &nbsp;<asp:Button ID="btnCreate" runat="server" Text="添加用户" OnClick="btnCreate_Click" />&nbsp;&nbsp;
      <asp:Button ID="btnReturn" runat="server" Text="返回公司列表" 
            onclick="btnReturn_Click"  />
    </div>
    <div>
         
          <p style="padding: 4px; margin: 5px; font-weight:bolder;"><asp:Label ID="lblLeaderName" runat="server" Text=""></asp:Label></p>  
         
    </div>
    <div>
        <asp:GridView ID="gvUsers" runat="server" AutoGenerateColumns="False" CellPadding="4"
            DataKeyNames="UserID" ForeColor="#333333" GridLines="None" OnRowCommand="gvUsers_RowCommand"
            OnRowDeleting="gvUsers_RowDeleting" AllowPaging="True" EmptyDataText="暂时没有数据"
            Style="width: 100%; text-align:center;" OnPageIndexChanging="gvUsers_PageIndexChanging" 
            onrowediting="gvUsers_RowEditing">
            <RowStyle BackColor="#EFF3FB" />
            <Columns>
                <asp:BoundField DataField="UserName" HeaderText="姓名" SortExpression="UserName" />
                <asp:BoundField DataField="CompanyName" HeaderText="公司" SortExpression="CompanyName" />
                <asp:TemplateField HeaderText="性别" SortExpression="Sex">
                    <ItemTemplate>
                        <%# (Convert.ToInt32(Eval("Sex")) == 1 ? "男" : "女")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="UserRoleName" HeaderText="角色" SortExpression="UserRoleName" />
                <asp:BoundField DataField="UserTypeName" HeaderText="用户类型" SortExpression="UserTypeName" />
                <asp:BoundField DataField="Credential" HeaderText="证件号" SortExpression="Credential" />
                <asp:BoundField DataField="IDCard" HeaderText="身份证号" SortExpression="IDCard" />
                <asp:BoundField DataField="CurrentIntegral" HeaderText="当前积分" SortExpression="CurrentIntegral" />
                <asp:TemplateField HeaderText="是否经过安全教育" SortExpression="IsSafetyEducation">
                    <ItemTemplate>
                        <%# (Convert.ToInt32(Eval("IsSafetyEducation")) == 1 ? "是" : "否")%>
                    </ItemTemplate>
                </asp:TemplateField>
<asp:BoundField DataField="GuardLine" HeaderText="警戒线" SortExpression="GuardLine" />
                <asp:TemplateField HeaderText="是否超出警戒线" SortExpression="">
                    <ItemTemplate>
                        <%# (Convert.ToInt32(Eval("GuardLine") )>= Convert.ToInt32(Eval("CurrentIntegral") ) ? "是" : "否")%>
                    </ItemTemplate>
                </asp:TemplateField>
               
                <asp:CommandField HeaderText="操作" ShowDeleteButton="True" ShowEditButton="True" ShowHeader="True" />
                
                <asp:TemplateField HeaderText="操作" Visible="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="btnViolation" runat="server" CommandName="Violation" CommandArgument='<%#Eval("UserID") %>'
                            Text="写入违章信息" />
                    </ItemTemplate>
                </asp:TemplateField>
                
                

                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:HiddenField ID="hUserID" runat="server" Value='<%# Eval("UserID") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:HiddenField ID="hCompanyID" runat="server" Value='<%# Eval("CompanyID") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
    </div>
    </form>
</body>
<script src="../script/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="../script/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>

</html>
